﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GeoWorkdayTime.aspx.cs" Inherits="GeoWeb.Demo.WorkDataConfig.GeoWorkdayTime" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>设置工作时间段</title>
    <script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
    <div id="Service" style="behavior:url(htc/webservice.htc)"></div>
    <script language="javascript">
        function OnClose()
        {
            window.close();
        }
        
        function OnUpdate()
        {
            var startday=document.getElementById("startday").value;
            var endday=document.getElementById("endday").value;
            var AmStarTime=document.getElementById("AmStarTime").value;
            var AmEndTime=document.getElementById("AmEndTime").value;
            var PmStarTime=document.getElementById("PmStarTime").value;
            var PmEndTime=document.getElementById("PmEndTime").value;
            
            if(startday==""||endday==""||AmStarTime==""||AmEndTime==""||PmStarTime==""||PmEndTime=="")
            {
                alert('不能有空值！');
            }
            else
            {
                var start=startday.split("-");
                var end=endday.split("-");
                var amstart=AmStarTime.split(":")
                var amend=AmEndTime.split(":")
                var pmstart=PmStarTime.split(":")
                var pmend=PmEndTime.split(":")
                
                var starttime=new Date(start[0],start[1],start[2],0,0,0);
                var endtime=new Date(end[0],end[1],end[2],0,0,0);
                var amstime=new Date(0,0,0,amstart[0],amstart[1],amstart[2]);
                var ametime=new Date(0,0,0,amend[0],amend[1],amend[2]);
                var pmstime=new Date(0,0,0,pmstart[0],pmstart[1],pmstart[2]);
                var pmetime=new Date(0,0,0,pmend[0],pmend[1],pmend[2]);
                
                if(starttime>endtime||amstime>ametime||ametime>pmstime||pmstime>pmetime)
                {
                    alert('时间格式不正确，请检查！');
                }
                else
                {
                    if(Service!=null)
                    {
                        Service.useService("WebServices/GeoWorkdayTime.asmx?WSDL","Update");
                        Service.Update.callService("UpdateWorkdayTime",startday,endday,AmStarTime,AmEndTime,PmStarTime,PmEndTime);	 	       	          
                    }
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="100%">
            <tr>
                <td align="left" width="20%">
                    <asp:Label ID="Label1" runat="server" Text="起始年月日："></asp:Label>
                </td>
                <td align="left" width="30%">
                    <input type="text" id="startday" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'2007-04-10',maxDate:'2027-01-01'})" class="Wdate" />
                </td>
                <td align="left" width="20%">
                    <asp:Label ID="Label2" runat="server" Text="终止年月日："></asp:Label>
                </td>
                <td align="left" width="30%">
                    <input type="text" id="endday" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'2007-04-10',maxDate:'2027-01-01'})" class="Wdate" />
                </td>
            </tr>
            <tr>
                <td colspan="4" align="center">
                    <asp:Label ID="Label3" runat="server" Text="(备注：年月日时间范围为2007年4月10日至2027年1月1日)"></asp:Label>
                </td>
            
            </tr>
            <tr>
                <td align="left" width="20%">
                    <asp:Label ID="lblAmStarTime" runat="server" Text="上午上班时间："></asp:Label>
                </td>
                <td align="left" width="30%">
                    <input type="text" id="AmStarTime" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'H:mm:ss'})" class="Wdate" />
                </td>
                <td align="left" width="20%">
                    <asp:Label ID="lblAmEndTime" runat="server" Text="上午下班时间："></asp:Label>
                </td>
                <td align="left" width="30%">
                    <input type="text" id="AmEndTime" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'H:mm:ss'})" class="Wdate" />
                </td>
            </tr>
            <tr>
                <td align="left" width="20%">
                    <asp:Label ID="lblPmStarTime" runat="server" Text="下午上班时间："></asp:Label>
                </td>
                <td align="left" width="30%">
                    <input type="text" id="PmStarTime" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'H:mm:ss'})" class="Wdate" />
                </td>
                <td align="left" width="20%">
                    <asp:Label ID="lblPmEndTime" runat="server" Text="下午下班时间："></asp:Label>
                </td>
                <td align="left" width="30%">    
                    <input type="text" id="PmEndTime" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'H:mm:ss'})" class="Wdate" />
                </td>
            </tr>
            
            <tr>
                <td align="center" colspan="2" style="width:50%">
                    <input id="btnUpdate" type="button" value="修改" onclick="OnUpdate()" />
                </td>
                <td align="center" colspan="2" style="width:50%">
                    <input id="btnClose" type="button" value="关闭" onclick="OnClose()" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
